<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/21 0021
 * Time: 17:17
 */

$redis_client = new swoole_redis; //Swoole\Redis
$redis_client->connect('127.0.0.1', 6379, function($redis_client, $result){
    echo 'connect' .PHP_EOL;
    var_dump($result);
    //同步 redis (new Redis()->set('key', 2));
    //异步
//    $redis_client->set('singwa_1', time(), function($redis_client, $result){
//        var_dump($result);
//    });

//    $redis_client->get('singwa_1', function($redis_client, $result){
//        var_dump($result);
//        $redis_client->close();
//    });

    $redis_client->keys('*gw*', function($redis_client, $result){
        var_dump($result);
        $redis_client->close();
    });
});

echo 'start' . PHP_EOL;